<?php echo $javascript->link('tooltip'); ?> 
<?php
echo $this->Session->flash();
?>
<?php echo $form->create('Counterpart'); ?>
<?php echo $form->hidden("Counterpart.final_evaluation_id", array('value' => $final_evaluation_id)); ?>
<table border="0">
    <tbody>
        <tr>
            <td>

                <?php
                echo $form->input('Counterpart.tipo', array(
                    'label' => __('Tipo Contrapartida', true),
                    'options' => array('Sin registro' => 'Sin registro', 'Certificada' => 'Certificada', 'Otra' => 'Otra'),
                ));
                ?>
                <?php
                echo $ajax->observeField('CounterpartTipo', array(
                    'url' => array('action' => 'select'),
                    'frequency' => 0.2,
                    'update' => 'cntp',
                    'indicator' => 'loading1'
                        )
                );
                ?>

                <div id="loading1" style="display: none;">
                    <?php echo $html->image('loading.gif', array('border' => "0", 'align' => 'center')); ?>
                </div>



                <div id="cntp">
                    <?php echo $form->input("Counterpart.nombre", array('label' => 'Contrapartida', 'type' => 'select', 'empty' => 'Seleccione')); ?>
                </div>



            </td>
        </tr>

        <tr>
            <td><?php echo $form->input("Counterpart.clase", array('options' => array('empty' => 'Seleccione un tipo', 'Proyecto' => 'Proyecto', 'Predio' => 'Predio'))); ?></td>
        </tr>
        <tr>
            <td><?php echo $form->input("Counterpart.valor"); ?></td>
        </tr>
    </tbody>
</table>
<?php
if ($this->Session->read('estado') == 0)
echo $ajax->submit('Guardar', array('url' => array('controller' => 'counterparts', 'action' => 'add', $final_evaluation_id), 'update' => 'contrapartidas', 'indicator' => 'loading'));
echo $ajax->link($html->image('regresar.gif', array('width' => '30', 'heigth' => '30', 'alt' => 'Regresar', 'title' => 'regresar')), array('controller' => 'counterparts', 'action' => 'index', $final_evaluation_id), array('update' => 'contrapartidas', 'indicator' => 'loading', 'escape' => false));
echo $form->end();
?>